package com.gljx.util;

import com.gljx.web.Entity.EnumClass;
import com.gljx.web.Entity.Student;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

public class EnumListFactory {
    public static List<Student> createEnumList() throws IllegalAccessException {
        EnumClass enumClass = new EnumClass();
        List<Student> lists = new ArrayList<>();
        Class clazz = enumClass.getClass();
        Field[] field = enumClass.getClass().getDeclaredFields();
        for(int i = 0 ; i<field.length ; i++){
            Student student = new Student();
            Field file = field[i];
            student.setCfstudentstate(((Long)file.get(clazz)));
            if(((Long)file.get(clazz)) == EnumClass.ybmState){
                student.setFnameL2("已报名");
            }else if(((Long)file.get(clazz)) == EnumClass.kmytgState){
                student.setFnameL2("科目一通过");
            }else if(((Long)file.get(clazz)) == EnumClass.kmywtgState){
                student.setFnameL2("科目一未通过");
            }else if(((Long)file.get(clazz)) == EnumClass.kmetgswksState){
                student.setFnameL2("科目二通过,科目三未开始");
            }else if(((Long)file.get(clazz)) == EnumClass.kmewtgswksState){
                student.setFnameL2("科目二未通过,科目三未开始");
            }else if(((Long)file.get(clazz)) == EnumClass.kmelczswksState){
                student.setFnameL2("科目二练车中,科目三未开始");
            }else if(((Long)file.get(clazz)) == EnumClass.kmetgstgState){
                student.setFnameL2("科目三通过,科目二通过");
            }else if(((Long)file.get(clazz)) == EnumClass.kmetgswtgState){
                student.setFnameL2("科目三未通过,科目二通过");
            }else if(((Long)file.get(clazz)) == EnumClass.kmetgslczState){
                student.setFnameL2("科目三练车中,科目二通过");
            }else if(((Long)file.get(clazz)) == EnumClass.yjyState){
                student.setFnameL2("已结业");
            }else if(((Long)file.get(clazz)) == EnumClass.ytxState){
                student.setFnameL2("已退学,未退款");
            }else if(((Long)file.get(clazz)) == EnumClass.mnkshgState){
                student.setFnameL2("模拟考试合格");
            }else if(((Long)file.get(clazz)) == EnumClass.ygqState){
                student.setFnameL2("已过期");
            }else if(((Long)file.get(clazz)) == EnumClass.zfState){
                student.setFnameL2("作废");
            }else if(((Long)file.get(clazz)) == EnumClass.kmslcewtgState){
                student.setFnameL2("科目三练车中,科目二未通过");
            }else if(((Long)file.get(clazz)) == EnumClass.kmslcewksState){
                student.setFnameL2("科目三练车中,科目二未开始");
            }else if(((Long)file.get(clazz)) == EnumClass.kmstgewtgState){
                student.setFnameL2("科目三通过,科目二未通过");
            }else if(((Long)file.get(clazz)) == EnumClass.kmstgelczState){
                student.setFnameL2("科目三通过,科目二练车中");
            }else if(((Long)file.get(clazz)) == EnumClass.kmstgewksState){
                student.setFnameL2("科目三通过,科目二未开始");
            }else if(((Long)file.get(clazz)) == EnumClass.kmswtgewtgState){
                student.setFnameL2("科目二未通过,科目三未通过");
            }else if(((Long)file.get(clazz)) == EnumClass.kmswtgswksState){
                student.setFnameL2("科目三未通过，科目二未开始");
            }else if(((Long)file.get(clazz)) == EnumClass.kmelczswtgState){
                student.setFnameL2("科目二练车中,科目三未通过");
            }else if(((Long)file.get(clazz)) == EnumClass.ytxytkState){
                student.setFnameL2("已退学,已退款");
                }else {
                student.setFnameL2("请选择状态");
            }
            lists.add(student);
        }
        /*lists.add(EnumClass.ybmState);
        lists.add(EnumClass.kmytgState);
        lists.add(EnumClass.kmywtgState);*/
        return  lists;
    }
}
